import { Dispatch } from "redux";
import { useDispatch } from "react-redux";

function useToast() {
  const dispatch = useDispatch<Dispatch<IToastAction>>();
  return (type: ToastType, message: string) => {
    dispatch({
      type: "Toast_Show",
      payload: {
        type,
        message,
      },
    });
  };
}

export { useToast };
